<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<!--通过按钮调用方法-->
<input type="button" value="按钮" onclick="f1()">

<script>
    //1.无参无返回值
    function f1(){
        console.log("f1");
    }
    //调用方法
    f1();

    //2.有参无返回值方法
    function f2(name,age) {
        console.log("f2"+name+age)
    }
    f2("莫菲特",28);

    //3.无参有返回值
    function f3() {
        return "这是返回值1";
        console.log()
    }
    let s = f3();
    console.log(s);

    //4.有参有返回值
    function f4(num1,num2) {
        return num1*num2;
    }
    let f = f4(2,3);
    console.log(f)

// 第二种声明方法的方式
let f5=function (name,age) {
        console.log("f5"+name+age);
}
f5("刘备",55);

    let f6=function (m,n) {
        return m+n;
    }
    console.log( f6(12,55));

//3.第三种声明方法的方式
let f7 = new Function("name","age","console.log(name+age)");
f7("张飞",33);


</script>
</body>
</html>